<!-- 页面外套 -->
<div class="page-wrapper" id="setup_attendance_group">

    <!-- 数据网格 -->
    <div class="datagrid datagrid-striped" id="setup_attendance_group_datagrid">

        <!-- 工具条组 -->
        <div class="tool-group">
            <div class="tool-deal">
                <label><button class="btn btn-primary" id="setup_attendance_group_add_btn"> <i class="icon icon-plus"></i> 添加</button></label>
                <div class="clearfix"></div>
            </div>
        </div>
        <!-- tool-group -->

        <div class="datagrid-container"></div>
        <ul class="pager btn-mini" data-elements="prev,pages,next"></ul>
    </div>
    <!-- datagrid -->

    <!-- 添加盒子 -->
    <div class="modal modal-for-page fade" aria-hidden="false" id="setup_attendance_group_add_box">
        <div class="modal-dialog modal-fullscreen">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
                    <h4 class="modal-title">添加</h4>
                </div>
                <div class="modal-body">
                    <form class="container form-horizontal">
                        
                        <!-- 考勤组设置 -->
                        <table class="table table-bordered">
                            <thead><tr><th>考勤组设置</th></tr></thead>
                            <tbody><tr><td>
                                <div class="form-group require">
                                    <label class="col-sm-2" for="setup_attendance_group_add_name">考勤组名称</label>
                                    <div class="col-sm-8"><input type="text" class="form-control" id="setup_attendance_group_add_name" style="max-width:358px"></div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2">考勤人员</label>
                                    <div class="col-sm-8"><ul class="tree tree-lines tree-chevrons" id="setup_attendance_group_add_tree"></ul></div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2" for="setup_attendance_group_add_rule">加班规则</label>
                                    <div class="col-sm-8"><select class="form-control" id="setup_attendance_group_add_rule" style="max-width:358px"></select></div>
                                </div>
                                </td></tr></tbody>
                        </table>

                        <!-- 工作日设置 -->
                        <table class="table table-bordered">
                            <thead><tr><th>工作日设置</th></tr></thead>
                            <tbody><tr><td>
                                <div class="form-group require">
                                    <label class="col-sm-2">工作日设置</label>
                                    <div class="col-sm-8">
                                        <div class="btn-group btn_group_result" data-toggle="buttons" id="setup_attendance_group_add_week" result="1,2,3,4,5">
                                            <label class="btn active"><input type="checkbox" value="1">周一</label>
                                            <label class="btn active"><input type="checkbox" value="2">周二</label>
                                            <label class="btn active"><input type="checkbox" value="3">周三</label>
                                            <label class="btn active"><input type="checkbox" value="4">周四</label>
                                            <label class="btn active"><input type="checkbox" value="5">周五</label>
                                            <label class="btn">       <input type="checkbox" value="6">周六</label>
                                            <label class="btn">       <input type="checkbox" value="7">周日</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2" for="setup_attendance_group_add_time">班次时间设置</label>
                                    <div class="col-sm-8"><select class="form-control" id="setup_attendance_group_add_time" style="max-width:358px"></select></div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2">法节自动排休</label>
                                    <div class="col-sm-8">
                                        <div class="btn-group btn_group_result" data-toggle="buttons" id="setup_attendance_group_add_vaca" result="true">
                                            <label class="btn active"><input type="radio" value="true">启用</label>
                                            <label class="btn">       <input type="radio" value="false">禁用</label>
                                        </div>
                                    </div>
                                </div>
                            </td></tr></tbody>
                        </table>

                        <!-- 考勤方式 -->
                        <table class="table table-bordered setup_attendance_group_add_table3">
                            <thead><tr><th colspan="2">考勤方式 <span class="text-danger text-thin">满足任意一种考勤方式即可完成打卡</span></th></tr></thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <div class="col-sm-2">
                                            <label class="for-label for_label_toggle" id="setup_attendance_group_add_type1" style="margin-top:7px;">
                                                <i class="icon icon-check-empty"></i> 根据办公地点考勤
                                            </label>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="input-group">
                                                <span class="input-group-addon">有效范围</span>
                                                <input type="number" class="form-control" id="setup_attendance_group_add_type1_range">
                                                <span class="input-group-addon">米</span>
                                            </div>
                                        </div>
                                        <div class="col-sm-7">
                                            <div class="input-group">
                                                <span class="input-group-addon">办公地点</span>
                                                <input type="text" class="form-control common_map_btn" placeholder="请选择办公地点" readonly id="setup_attendance_group_add_type1_addr" mapx="" mapy="">
                                                <span class="input-group-addon common_map_reset"><i class="icon icon-reply"></i></span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="col-sm-8">
                                            <label class="for-label for_label_toggle" id="setup_attendance_group_add_type2">
                                                <i class="icon icon-check-empty"></i> 根据公司WIFI
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="col-sm-8">
                                            <label class="for-label for_label_toggle" id="setup_attendance_group_add_type3">
                                                <i class="icon icon-check-empty"></i> 允许外勤打卡
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

                    </form>
                    <div class="text-center" style="margin:100px 0">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="setup_attendance_group_add_submit">提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- setup_attendance_group_add_box -->

    <!-- 修改盒子 -->
    <div class="modal modal-for-page fade" aria-hidden="false" id="setup_attendance_group_edit_box">
        <div class="modal-dialog modal-fullscreen">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
                    <h4 class="modal-title">修改</h4>
                </div>
                <div class="modal-body">
                    <form class="container form-horizontal">
                        
                        <!-- 考勤组设置 -->
                        <table class="table table-bordered">
                            <thead><tr><th>考勤组设置</th></tr></thead>
                            <tbody><tr><td>
                                <div class="form-group require">
                                    <label class="col-sm-2" for="setup_attendance_group_edit_name">考勤组名称</label>
                                    <div class="col-sm-8"><input type="text" class="form-control" id="setup_attendance_group_edit_name" style="max-width:358px"></div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2">考勤人员</label>
                                    <div class="col-sm-8"><ul class="tree tree-lines tree-chevrons" id="setup_attendance_group_edit_tree"></ul></div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2" for="setup_attendance_group_edit_rule">加班规则</label>
                                    <div class="col-sm-8"><select class="form-control" id="setup_attendance_group_edit_rule" style="max-width:358px"></select></div>
                                </div>
                                </td></tr></tbody>
                        </table>

                        <!-- 工作日设置 -->
                        <table class="table table-bordered">
                            <thead><tr><th>工作日设置</th></tr></thead>
                            <tbody><tr><td>
                                <div class="form-group require">
                                    <label class="col-sm-2">工作日设置</label>
                                    <div class="col-sm-8">
                                        <div class="btn-group btn_group_result" data-toggle="buttons" id="setup_attendance_group_edit_week" result="1,2,3,4,5">
                                            <label class="btn active"><input type="checkbox" value="1">周一</label>
                                            <label class="btn active"><input type="checkbox" value="2">周二</label>
                                            <label class="btn active"><input type="checkbox" value="3">周三</label>
                                            <label class="btn active"><input type="checkbox" value="4">周四</label>
                                            <label class="btn active"><input type="checkbox" value="5">周五</label>
                                            <label class="btn">       <input type="checkbox" value="6">周六</label>
                                            <label class="btn">       <input type="checkbox" value="7">周日</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2" for="setup_attendance_group_edit_time">班次时间设置</label>
                                    <div class="col-sm-8"><select class="form-control" id="setup_attendance_group_edit_time" style="max-width:358px"></select></div>
                                </div>
                                <div class="form-group require">
                                    <label class="col-sm-2">法节自动排休</label>
                                    <div class="col-sm-8">
                                        <div class="btn-group btn_group_result" data-toggle="buttons" id="setup_attendance_group_edit_vaca" result="true">
                                            <label class="btn active"><input type="radio" value="true">启用</label>
                                            <label class="btn">       <input type="radio" value="false">禁用</label>
                                        </div>
                                    </div>
                                </div>
                            </td></tr></tbody>
                        </table>

                        <!-- 考勤方式 -->
                        <table class="table table-bordered setup_attendance_group_edit_table3">
                            <thead><tr><th colspan="2">考勤方式 <span class="text-danger text-thin">满足任意一种考勤方式即可完成打卡</span></th></tr></thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <div class="col-sm-2">
                                            <label class="for-label for_label_toggle" id="setup_attendance_group_edit_type1" style="margin-top:7px;">
                                                <i class="icon icon-check-empty"></i> 根据办公地点考勤
                                            </label>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="input-group">
                                                <span class="input-group-addon">有效范围</span>
                                                <input type="number" class="form-control" id="setup_attendance_group_edit_type1_range">
                                                <span class="input-group-addon">米</span>
                                            </div>
                                        </div>
                                        <div class="col-sm-7">
                                            <div class="input-group">
                                                <span class="input-group-addon">办公地点</span>
                                                <input type="text" class="form-control common_map_btn" placeholder="请选择办公地点" readonly id="setup_attendance_group_edit_type1_addr" mapx="" mapy="">
                                                <span class="input-group-addon common_map_reset"><i class="icon icon-reply"></i></span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="col-sm-8">
                                            <label class="for-label for_label_toggle" id="setup_attendance_group_edit_type2">
                                                <i class="icon icon-check-empty"></i> 根据公司WIFI
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="col-sm-8">
                                            <label class="for-label for_label_toggle" id="setup_attendance_group_edit_type3">
                                                <i class="icon icon-check-empty"></i> 允许外勤打卡
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

                    </form>
                    <div class="text-center" style="margin:100px 0">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="setup_attendance_group_edit_submit">提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- setup_attendance_group_edit_box -->

    <!-- 删除盒子 -->
    <div class="modal modal-for-page fade" aria-hidden="false" id="setup_attendance_group_dele_box">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
                    <h4 class="modal-title">删除</h4>
                </div>
                <div class="modal-body">
                    <p class="text-danger"><i class="icon icon-warning-sign"></i> 是否删除？</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-danger"  id="setup_attendance_group_dele_submit">提交</button>
                </div>
            </div>
        </div>
    </div>
    <!-- setup_attendance_group_dele_box -->

</div>
<!-- page-wrapper -->

<script>
$(function(){
   
    //变量声明-----------------------------------------------------------------------------------------------
    var 
    setup_attendance_group                  = $("#setup_attendance_group"),                 //页面ID
    setup_attendance_group_datagrid         = $("#setup_attendance_group_datagrid"),        //数据表格
    //添加
    setup_attendance_group_add_btn          = $("#setup_attendance_group_add_btn"),         //添加按钮
    setup_attendance_group_add_box          = $("#setup_attendance_group_add_box"),         //添加盒子
    setup_attendance_group_add_submit       = $("#setup_attendance_group_add_submit"),      //添加提交
    setup_attendance_group_add_name         = $("#setup_attendance_group_add_name"),        //考勤名称
    setup_attendance_group_add_tree         = $("#setup_attendance_group_add_tree"),        //考勤人员
    setup_attendance_group_add_rule         = $("#setup_attendance_group_add_rule"),        //加班规则
    setup_attendance_group_add_week         = $("#setup_attendance_group_add_week"),        //工作日设置
    setup_attendance_group_add_vaca         = $("#setup_attendance_group_add_vaca"),        //假期日设置
    setup_attendance_group_add_time         = $("#setup_attendance_group_add_time"),        //班次设置
    setup_attendance_group_add_table3       = $(".setup_attendance_group_add_table3"),      //考勤方式表格
    setup_attendance_group_add_type1        = $("#setup_attendance_group_add_type1"),       //考勤方式1
    setup_attendance_group_add_type1_range  = $("#setup_attendance_group_add_type1_range"), //范围
    setup_attendance_group_add_type1_addr   = $("#setup_attendance_group_add_type1_addr"),  //地点
    setup_attendance_group_add_type2        = $("#setup_attendance_group_add_type2"),       //考勤方式2
    setup_attendance_group_add_type3        = $("#setup_attendance_group_add_type3"),       //考勤方式3
    //修改
    setup_attendance_group_edit_box         = $("#setup_attendance_group_edit_box"),        //修改盒子
    setup_attendance_group_edit_submit      = $("#setup_attendance_group_edit_submit"),     //修改提交
    setup_attendance_group_edit_name        = $("#setup_attendance_group_edit_name"),       //考勤名称
    setup_attendance_group_edit_tree        = $("#setup_attendance_group_edit_tree"),       //考勤人员
    setup_attendance_group_edit_rule        = $("#setup_attendance_group_edit_rule"),       //加班规则
    setup_attendance_group_edit_week        = $("#setup_attendance_group_edit_week"),       //工作日设置
    setup_attendance_group_edit_vaca        = $("#setup_attendance_group_edit_vaca"),       //假期日设置
    setup_attendance_group_edit_time        = $("#setup_attendance_group_edit_time"),       //班次设置
    setup_attendance_group_edit_table3      = $(".setup_attendance_group_edit_table3"),     //考勤方式表格
    setup_attendance_group_edit_type1       = $("#setup_attendance_group_edit_type1"),      //考勤方式1
    setup_attendance_group_edit_type1_range = $("#setup_attendance_group_edit_type1_range"),//范围
    setup_attendance_group_edit_type1_addr  = $("#setup_attendance_group_edit_type1_addr"), //地点
    setup_attendance_group_edit_type2       = $("#setup_attendance_group_edit_type2"),      //考勤方式2
    setup_attendance_group_edit_type3       = $("#setup_attendance_group_edit_type3"),      //考勤方式3    
    //删除
    setup_attendance_group_dele_box         = $("#setup_attendance_group_dele_box"),        //删除盒子
    setup_attendance_group_dele_submit      = $("#setup_attendance_group_dele_submit");     //删除提交

    //接口对象-----------------------------------------------------------------------------------------------
    if( window.STATE == "local" ){

        //本地接口
        var setup_attendance_group_api = {
            datagrid   : LOCAL + "Test/test_datagrid.json",                                 //数据表格
            select     : LOCAL + "Test/test_select.json",                                   //下拉选项
            modal_edit : LOCAL + "Test/Setup/Attendance/group_edit.json",                   //修改盒子
        }

    } else if ( window.STATE == "route" ){

        //远程接口
        var setup_attendance_group_api = {
            datagrid   : LOCAL + "Test/test_datagrid.json",                                 //数据表格
            select     : LOCAL + "Test/test_select.json",                                   //下拉选项
            modal_edit : LOCAL + "Test/Setup/Attendance/group_edit.json",                   //修
        }

    }

    //数据表格-----------------------------------------------------------------------------------------------
    setup_attendance_group_datagrid.datagrid({
        height      : zui_datagrid_height(setup_attendance_group_datagrid),
        sortable    : false,
        cache       : false,
        showRowIndex: true,
        configs     : {
            R0:{className:"text-center"},
            C1:{className:"cell-hidden"}
        },
        states      : {
            pager           : {
                page        : 1,
                recPerPage  : window.REC_PER_PAGE,
            }
        },
        dataSource : {
            cols   : [
                {name:"id",      label:"ID",  width:49 },
                {name:"tex10",   label:"名称",width:250},
                {name:"text1",   label:"人数",width:80 },
                {name:"operate", label:"操作",width:150,
                    html:true,
                    valueOperator : {
                        getter : function(dataValue,cell){
                            var temp = `
                                <a class="setup_attendance_group_edit_btn" rowIndex="${cell.rowIndex}">修改</a>
                                <a class="setup_attendance_group_dele_btn" rowIndex="${cell.rowIndex}">删除</a>
                            `;
                            return temp;
                        }
                    }
                }
            ],
            remote : function(){
                return {
                    url     : setup_attendance_group_api.datagrid,
                    type    : "POST",
                    dataType: "json",
                }
            }
        }
    });

    //变量声明-----------------------------------------------------------------------------------------------
    var
    setup_attendance_group_datagrid_obj   = setup_attendance_group_datagrid.data("zui.datagrid"),   //表格对象
    setup_attendance_group_edit_btn       = ".setup_attendance_group_edit_btn",                     //修改按钮
    setup_attendance_group_dele_btn       = ".setup_attendance_group_dele_btn";                     //删除按钮

    //节点树创建(添加+修改)--------------------------------------------------------------------------------
    common_tree_staff(setup_attendance_group_add_tree,false,true);        //添加
    common_tree_staff(setup_attendance_group_edit_tree,false,true);       //修改

    //下拉选项-----------------------------------------------------------------------------------------------
    //加班规则
    $.ajax({
        url     : setup_attendance_group_api.select,
        type    : "post",
        dataType: "json",
        data    : {},
        success : function(data){
            if( data.status>0 ){
                var data = data.data;
                var option = "<option>全部</option>";
                for(var i=0;i<data.length;i++){
                    option += "<option value='"+data[i].id+"'>"+data[i].name+"</option>"
                }
                setup_attendance_group_add_rule.html(option);               //添加
                setup_attendance_group_edit_rule.html(option);              //修改 
            }
        }
    });
    //班次设置
    $.ajax({
        url     : setup_attendance_group_api.select,
        type    : "post",
        dataType: "json",
        data    : {},
        success : function(data){
            if( data.status>0 ){
                var data = data.data;
                var option = "<option>全部</option>";
                for(var i=0;i<data.length;i++){
                    option += "<option value='"+data[i].id+"'>"+data[i].name+"</option>"
                }
                setup_attendance_group_add_time.html(option);               //添加
                setup_attendance_group_edit_time.html(option);              //修改 
            }
        }
    });

    //添加按钮-----------------------------------------------------------------------------------------------
    setup_attendance_group_add_btn.click(function(){

        //数据重置
        common_form_reset();
        common_tree_staff_reset( setup_attendance_group_add_tree );
        // 
        //面板显示
        setup_attendance_group_add_box.modal("show");
        
    });
    //添加提交
    setup_attendance_group_add_submit.click(function(){
 
        //远程提交
        $.ajax({
            url     : API.test_response,
            type    : "post",
            dataType: "json",
            data    : {
                name : setup_attendance_group_add_name.val(),
                tree : setup_attendance_group_add_tree.attr("result"),
                rule : setup_attendance_group_add_rule.val(),
                week : setup_attendance_group_add_week.attr("result"),
                time : setup_attendance_group_add_time.val(),
                vaca : setup_attendance_group_add_vaca.attr("result"),
                type1: setup_attendance_group_add_type1.find(".icon").hasClass("icon-checked"),
                type2: setup_attendance_group_add_type1.find(".icon").hasClass("icon-checked"),
                type3: setup_attendance_group_add_type1.find(".icon").hasClass("icon-checked"),
                range: setup_attendance_group_add_type1_range.val(),
                addr : setup_attendance_group_add_type1_addr.val(),
                mapx : setup_attendance_group_add_type1_addr.attr("mapx"),
                mapy : setup_attendance_group_add_type1_addr.attr("mapy"),
            },
            success : function(data){
                if( data.status>0 ){
                    um_tip(data.message);
                    zui_datagrid_reset(setup_attendance_group_datagrid_obj,setup_attendance_group_api.datagrid);
                } else {
                    um_tip(data.message,"1500","text-danger");
                }
            }
        });

    });

    //修改按钮-----------------------------------------------------------------------------------------------
    $(document).on("click",setup_attendance_group_edit_btn,function(){
  
        //数据ID
        var data_id = zui_datagrid_get_id($(this).attr("rowIndex"));

        //远程提交
        $.ajax({
            url     : setup_attendance_group_api.modal_edit,
            type    : "post",
            dataType: "json",
            data    : { id:data_id },
            success : function(data){
                if( data.status>0 ){
                    var data = data.data;

                    //数据赋值
                    setup_attendance_group_edit_name.val( data.name );
                    common_tree_staff_read(setup_attendance_group_edit_tree,data.tree);
                    setup_attendance_group_edit_rule.val( data.rule );
                    //工作日
                    setup_attendance_group_edit_week.attr("result",data.week).find(".btn").removeClass("active");
                    var week = data.week.split(",");
                    for( var i=0;i<week.length;i++ ){ 
                        setup_attendance_group_edit_week.find(".btn").eq(week[i]-1).addClass("active"); 
                    }
                    //班次设置
                    setup_attendance_group_edit_time.val( data.time );
                    //法节自动排休
                    ( data.vaca==true  ) ? setup_attendance_group_edit_vaca.find(".btn").eq(0).trigger("click") : setup_attendance_group_edit_vaca.find(".btn").eq(1).trigger("click");
                    //考勤方式
                    ( data.type1==true ) ? setup_attendance_group_edit_type1.find(".icon").removeClass("icon-check-empty").addClass("icon-checked") : setup_attendance_group_edit_type1.find(".icon").removeClass("icon-checked").addClass("icon-check-empty");
                    ( data.type2==true ) ? setup_attendance_group_edit_type2.find(".icon").removeClass("icon-check-empty").addClass("icon-checked") : setup_attendance_group_edit_type2.find(".icon").removeClass("icon-checked").addClass("icon-check-empty");
                    ( data.type3==true ) ? setup_attendance_group_edit_type3.find(".icon").removeClass("icon-check-empty").addClass("icon-checked") : setup_attendance_group_edit_type3.find(".icon").removeClass("icon-checked").addClass("icon-check-empty");

                    //地图赋值
                    setup_attendance_group_edit_type1_range.val(data.range ),
                    setup_attendance_group_edit_type1_addr.val( data.addr ),
                    setup_attendance_group_edit_type1_addr.attr("mapx",data.mapx),
                    setup_attendance_group_edit_type1_addr.attr("mapy",data.mapy),

                    //其他操作
                    setup_attendance_group_edit_submit.attr("dataId",data_id);  //数据ID传值
                    setup_attendance_group_edit_box.modal("show");              //盒子显示

                } else {
                    um_tip(data.message,"1500","text-danger");
                }
            }
        });

    });
    //修改提交
    setup_attendance_group_edit_submit.click(function(){

        //数据ID
        var data_id = $(this).attr("dataId");

        //远程提交
        $.ajax({
            url     : API.test_response,
            type    : "post",
            dataType: "json",
            data    : { 
                id   : data_id,
                name : setup_attendance_group_edit_name.val(),
                tree : setup_attendance_group_edit_tree.attr("result"),
                rule : setup_attendance_group_edit_rule.val(),
                week : setup_attendance_group_edit_week.attr("result"),
                time : setup_attendance_group_edit_time.val(),
                vaca : setup_attendance_group_edit_vaca.attr("result"),
                type1: setup_attendance_group_edit_type1.find(".icon").hasClass("icon-checked"),
                type2: setup_attendance_group_edit_type1.find(".icon").hasClass("icon-checked"),
                type3: setup_attendance_group_edit_type1.find(".icon").hasClass("icon-checked"),
                range: setup_attendance_group_edit_type1_range.val(),
                addr : setup_attendance_group_edit_type1_addr.val(),
                mapx : setup_attendance_group_edit_type1_addr.attr("mapx"),
                mapy : setup_attendance_group_edit_type1_addr.attr("mapy"),
             },
            success : function(data){
                if( data.status>0 ){
                    um_tip(data.message);
                    zui_datagrid_reset(setup_attendance_group_datagrid_obj,setup_attendance_group_api.datagrid);
                } else {
                    um_tip(data.message,"1500","text-danger");
                }
            }
        });

    });

    //删除按钮-----------------------------------------------------------------------------------------------
    $(document).on("click",setup_attendance_group_dele_btn,function(){

        //数据ID
        var data_id = zui_datagrid_get_id($(this).attr("rowIndex"));

        //其他操作
        setup_attendance_group_dele_submit.attr("dataId",data_id);                                //ID传值
        setup_attendance_group_dele_box.modal("show");                                            //面板显示

    });
    //删除提交
    setup_attendance_group_dele_submit.click(function(){

        //数据ID
        var data_id = $(this).attr("dataId");

        //远程提交
        $.ajax({
            url     : API.test_response,
            type    : "post",
            dataType: "json",
            data    : { id:data_id },
            success : function(data){
                if( data.status>0 ){
                    um_tip(data.message);
                    zui_datagrid_reset(setup_attendance_group_datagrid_obj,setup_attendance_group_api.datagrid);
                } else {
                    um_tip(data.message,"1500","text-danger");
                }
            }
        });

    });

    //地图重置-----------------------------------------------------------------------------------------------
    $(".common_map_reset").click(function(){
        var common_map_btn =  $(this).prev(".common_map_btn");
        common_map_btn.val("").attr("mapx","").attr("mapy","");
    });

});//预加载结尾
</script>